import threading
import dev

class SafeThread(threading.Thread):
	def __init__(self):
		threading.Thread.__init__(self)
		self.stop = threading.Event()

	def terminate(self):
		self.stop.set()

	def run(self):
		while not self.stop.is_set():
			self.step()

	def step(self):
		raise dev.AbstractException('Thread.step')
